package com.dsy.consumer.controller;

import com.dsy.common.Test1Service;
import com.dsy.common.Test2Service;
import com.dsy.core.annotation.RpcInvoker;
import com.dsy.core.common.constants.FaultTolerantRules;
import com.dsy.core.common.constants.LoadBalancerRules;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {


    @RpcInvoker(timeout = 10000L,faultTolerant = FaultTolerantRules.Failover,loadBalancer = LoadBalancerRules.RoundRobin)
    private Test1Service test1Service;

    @RpcInvoker
    private Test2Service test2Service;
    @RequestMapping("/test1/{key}")
    public String test1(@PathVariable("key") String key){
         test1Service.test1(key);
         return "ok!";
    }

    @RequestMapping("/test2/{key}")
    public String test2(@PathVariable("key") String key){
        test2Service.test22(key);
        return " ok!";
    }
}
